import axios from '../../utils/axios/request'

// 用户登录
export function userLoginApi(data) {
    return axios({
        url: '/users/user-login',
        method: 'post',
        data
    })
}

// 获取用户信息
export function getUsersInfoApi(params) {
    return axios({
        url: '/users/user-info',
        method: 'get',
        params
    })
}

// 获取users列表
export function getListApi(params) {
    return axios({
        url: '/users/user-list',
        method: 'get',
        params
    })
}

// 新增用户
export function addUserApi(data) {
    return axios({
        url: "/users/save-user",
        method: 'post',
        data
    })
}

// 删除用户
export function deleteUserApi(params) {
    return axios({
        url: '/users/delete-user',
        method: 'get',
        params
    })
}

// 新增用户
export function updateUserApi(data) {
    return axios({
        url: '/users/update-user',
        method: 'post',
        data
    })
}

// users头像上传
export function uploadApi(data) {
    return axios({
        url: "/users/upload-avatar",
        method: 'post',
        data
    })
}

// 获取msbd列表
export function getMsbdListApi(params) {
    return axios({
        url: '/msbd/get-msbd',
        method: 'get',
        params
    })
}
///////////////////////////////////////////////////
// 获取classify列表
export function getClassifyApi(params) {
    return axios({
        url: '/classify/get-classify',
        method: 'get',
        params
    })
}

// 新增classify列表
export function addClassifyApi(data) {
    return axios({
        url: '/classify/add-classify',
        method: 'post',
        data
    })
}

// 修改classify 列表
export function updateClassifyApi(data) {
    return axios({
        url: '/classify/update-classify',
        method: 'post',
        data
    })
}

// 删除classify 列表
export function deleteClassifyApi(params) {
    return axios({
        url: '/classify/delete-classify',
        method: 'get',
        params
    })
}

//////////////////////////////////////////////////////////
// 获取questions列表
export function getQuestionsApi(params) {
    return axios({
        url: '/questions/examList',
        method: 'get',
        params
    })
}

// 新增questions列表
export function addQuestionsApi(data) {
    console.log(data);
    data.options = JSON.stringify(data.options)
    return axios({
        url: '/questions/saveExam',
        method: 'post',
        data
    })
}

// 删除questions 列表
export function deleteQuestionsApi(params) {
    return axios({
        url: '/questions/deleteExam',
        method: 'get',
        params
    })
}

//修改questions 列表
export function updateQuestionsApi(data) {
    data.options = JSON.stringify(data.options)
    return axios({
        url: '/questions/updateExam',
        method: 'post',
        data
    })
}

////////////////////////////////////////////

// 获取50条数据

export function getexamApi(params) {
    console.log(params)
    return axios({
        url: '/questions/randList',
        method: 'get',
        params
    })
}

